﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Logging
/// </summary>
public class Logging
{
    public string FileName { get; set; }
    public Logging()
    {
        this.FileName = "c:\\logging\\WebApp.log";
    }

    public void WriteLine(string strApp, string strLine)
    {
        using (StreamWriter objWriter = new StreamWriter(FileName, true))
        {
            try
            {
                string strPrefix = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss UTC") + " : " + strApp.PadRight(20) + " - ";
                strLine = strPrefix + strLine;
                objWriter.WriteLine(strLine);
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
    }
}